﻿using GC_VKMD.MusicDownloader.Abstractions.Interfaces.Helpers;
using GC_VKMD.MusicDownloaderClient.Abstractions.Interfaces.Factories.ViewModel;
using GC_VKMD.MusicDownloaderClient.Abstractions.Interfaces.Helpers;
using GC_VKMD.MusicDownloaderClient.ViewModels;
using GC_VKMD.MusicDownloaderClient.ViewModels.Parameters;

namespace GC_VKMD.MusicDownloaderClient.Factories.ViewModel
{
	public class MusicDownloaderViewModelFactory : IMusicDownloaderViewModelFactory
	{
		#region Variables

		private readonly IApplicationConfiguration _applicationConfiguration;
		private readonly IVKMusicDownloader _vkMusicDownloader;

		#endregion

		#region Constructors

		public MusicDownloaderViewModelFactory(IApplicationConfiguration applicationConfiguration, IVKMusicDownloader vkMusicDownloader)
		{
			_applicationConfiguration = applicationConfiguration;
			_vkMusicDownloader = vkMusicDownloader;
		}

		#endregion

		#region IVKAutorizationViewModelFactory Members

		public MusicDownloaderViewModel Create(MusicDownloaderViewModelParameters parameters)
		{
			if (parameters != null)
			{
				parameters.ApplicationConfiguration = _applicationConfiguration;
				parameters.VkMusicDownloader = _vkMusicDownloader;
			}

			return new MusicDownloaderViewModel(parameters);
		}

		#endregion
	}
}
